//打开层
function openDiv(id)
{
	var yc=document.getElementById(id);
	if(yc.style.display=="none")
	{
		yc.style.display="block";
	}
}
function openVDiv(id)
{
	var yc=document.getElementById(id);
	if(yc.style.visibility=="hidden")
	{
		yc.style.visibility="visible";
	}
}
//关闭层

function closeVDiv(id)
{
	var yc=document.getElementById(id);
	if(yc.style.visibility=="visible")
	{
		yc.style.visibility="hidden";
	}
}
function closeDiv(id)
{
	var yc=document.getElementById(id);
	if(yc.style.display=="block")
	{
		yc.style.display="none";
	}
}

//删除table的行
function deleteRow(id_one,id_two,table_name)
{
	var t_id = document.getElementById(id_one);
	var resultinfo = document.getElementById(id_two);
	if(resultinfo!=null && t_id!=null)
	{
		if(resultinfo.value=='success')
		{
			var tre = document.getElementById(t_id.value);
			var tablee = document.getElementById(table_name);
			tablee.deleteRow(tre.rowIndex);
		}
	}
}
function closediv(contant)
{
	var selectArray = document.getElementsByTagName("select");
	for(var i=0;i<selectArray.length;i++)
	{
		var yc=selectArray[i];
		if(yc.style.visibility=="hidden")
		{
			yc.style.visibility="visible";
		}
	}
	closeDiv(contant);
	closeDiv("mask");
}
//检查上传文件是否为空
function check(id,divid){
	var file = document.getElementById(id);
	if(file.value==""||file.value==null)
	{
		alert("上传文件不能为空");
		return false;
	}
	/*
	if(!judgeUrl(file.value))
	{
		return false;
	}
	*/
	if(!judgeType(file.value))
	{
		return false;
	}
	var divo = document.getElementById(divid);
	if(divo!=null)
	{
		openDiv(divid);
		openDiv("mask");
	}
	return true;
}
//判断路径
function judgeUrl(url)
{
	var regEx = /^[a-zA-Z]:\\[a-zA-Z_0-9\\]*/;
	if(!regEx.exec(url))
	{
		alert("上传文件路径不正确");
		return false;
	}
	return true;
}
//判断类型 
function judgeType(url)
{
	var type = getExt(url);
	var extlist = ".rar.doc.xls";
	if(extlist.indexOf(type)==-1)
	{
		alert("扩展名:"+type+"不是指定的类型,指定类型为rar,doc,xls");
		return false;
	}
	return true;
}
//得到文件类型
function getExt(sUrl)
{
        var arrList = sUrl.split(".");
        return arrList[arrList.length-1];
}
//上传判断是否为firefox
function readFile(fileBrowser) {   
    if (navigator.userAgent.indexOf("MSIE")!=-1)   
        readFileIE(fileBrowser);   
    else if (navigator.userAgent.indexOf("Firefox")!=-1 || navigator.userAgent.indexOf("Mozilla")!=-1)   
        readFileFirefox(fileBrowser);   
    else  
        alert("Not IE or Firefox (userAgent=" + navigator.userAgent + ")");   
}   
  
function readFileFirefox(fileBrowser) {   
    alert('您用的是firefox，此功能将无法正常运行，请换成ie');  
}   
  
function readFileIE(fileBrowser) {   
    
}   